import { createRouter, createWebHistory } from 'vue-router';
import Home from '@/pages/home.vue';
import detail from '@/pages/detail.vue';
import base_detail from '@/pages/base_detail.vue';

const routes = [
  {
    path: '/home',
    name: 'Home',
    component: Home
  },
  {
    path: '/detail',
    name: 'detail',
    component: detail
  },
  {
    path: '/base_detail',
    name: 'base_detail',
    component: base_detail
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

router.afterEach((to, from) => {
  const toDepth = to.path.split('/').length;
  const fromDepth = from.path.split('/').length;
  console.log({ to, from });

  to.meta.transition = toDepth < fromDepth ? 'slide-right' : 'slide-left';
});

export default router;
